package com.app.oral.dto

import java.time.LocalDateTime

/**
 * 试卷详情响应 - 包含基础信息和短文朗读内容
 */
data class ExamPaperDetailResponse(
    val id: Long,
    val title: String,
    val targetGrade: Int,
    val paperType: String,
    val createdTime: LocalDateTime?,
    val readingModule: ReadingModuleResponse
)

/**
 * 试卷完整响应 - 包含所有模块数据
 */
data class ExamPaperCompleteResponse(
    val id: Long,
    val title: String,
    val targetGrade: Int,
    val paperType: String,
    val createdTime: LocalDateTime?,
    val readingModule: ReadingModuleResponse,
    val listeningModule: ListeningModuleResponse,
    val dialogueModule: DialogueModuleResponse,
    val topicModule: TopicModuleResponse
)

/**
 * 短文朗读模块
 */
data class ReadingModuleResponse(
    val content: String,
    val audioFileId: String = ""
)

/**
 * 视听应答模块
 */
data class ListeningModuleResponse(
    val questions: List<ListeningQuestion>
)

data class ListeningQuestion(
    val number: Int,
    val questionText: String = "",     // 题目文本内容
    val questionFileId: String = "",   // 存储问题音频COS文件ID
    val imageFileId: String = "",      // 存储图片COS文件ID
    val answer: String = ""
)

/**
 * 情景对话模块
 */
data class DialogueModuleResponse(
    val questions: List<DialogueQuestion>
)

data class DialogueQuestion(
    val number: Int,
    val question: String,
    val audioFileId: String = "",      // 存储COS文件ID
    val answer: String = ""
)

/**
 * 话题简述模块
 */
data class TopicModuleResponse(
    val topicBrief: String,
    val keyPoints: List<String>,
    val referenceAnswers: List<String>
)

/**
 * 通用模块响应封装
 */
data class ModuleResponse<T>(
    val moduleType: ModuleType,
    val data: T,
    val nextModule: ModuleType?
)

/**
 * 模块类型枚举
 */
enum class ModuleType(val displayName: String) {
    READING("短文朗读"),
    LISTENING("视听应答"),
    DIALOGUE("情景对话"),
    TOPIC("话题简述");
    
    fun next(): ModuleType? = when (this) {
        READING -> LISTENING
        LISTENING -> DIALOGUE
        DIALOGUE -> TOPIC
        TOPIC -> null
    }
}

/**
 * 批量获取模块请求
 */
data class BatchModuleRequest(
    val modules: List<String>  // 模块名称列表：["dialogue", "topic"]
)